﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'upLoad.jsp' starting page</title>
     <script language='javascript'> 
        function getFullPath(obj) 
        { 
        	
            return window.URL.createObjectURL(obj.files[0]); 
        } 
        
        
        function showPic(){
        		var pic = document.getElementById("pic");
        		
        		alert('路径='+pic.value);
        		alert('加密路径='+window.URL.createObjectURL(pic.files[0]));
        		
        		document.getElementById("img").src = window.URL.createObjectURL(pic.files[0]); 
        }
    </script> 
  </head>
  
  <body>
    <input id="pic" type="file" onchange="showPic()" /> 
    <hr/>
    <img id="img" src="statics/images/ad20.jpg" width="400" height="400"/>
  </body>
</html>
